from osgeo import ogr
import os

shpfile = os.path.join(os.getcwd(),"include","dataset","shp.shp")

if os.path.exists(shpfile):
    drv: ogr.Driver = ogr.GetDriverByName("Esri shapefile")
    dataSource:ogr.DataSource = drv.Open(shpfile, 1)
    layer: ogr.Layer = dataSource.GetLayer(0)
    layerDefn:ogr.FeatureDefn = layer.GetLayerDefn()
    layer.DeleteField(2)
    dataSource.Destroy()
else:
    print("数据不存在！")